#9-1
# class Restaurant():
#     def __init__(self, name, type):
#         self.name = name
#         self.type = type
#     def describe(self):
#         print("the restaurant's name is " + self.name.title() + "." +
#               "And the cuisine type is " + self.type + ".")
#     def open(self):
#         print("the " + self.name + " is opening!")
# dt_restaurant = Restaurant("眉州东坡", "川菜")
# print(dt_restaurant)
# dt_restaurant.describe()
# dt_restaurant.open()
# #9-2
# mt_restaurant = Restaurant("小吊梨汤", "京菜")
# ut_restaurant = Restaurant("云海肴","滇菜")
# mt_restaurant.describe()
# ut_restaurant.describe()
#9-3所以其实初始值设定越简洁越好，最好不应该有公式等变形计算
# class User():
#     def __init__(self, first_name, last_name):
#         self.full_name = first_name + " " + last_name
#     def describe(self):
#         print("the user's full name is " + self.full_name.title() +".")
#     def greet(self):
#         print("hello! " + self.full_name.title())
# user1 = User("albert", "einstein")
# user2 = User("mark","tuwein")
# user3 = User("jennie", "granger")
# user1.describe()
# user1.greet()
# user2.describe()
# user2.greet()
# user3.describe()
# user3.greet()
#9-4
# class Restaurant():
#     def __init__(self, name, type):
#         self.name = name
#         self.type = type
#         self.number_served = 0
#     def describe(self):
#         print("the restaurant's name is " + self.name.title() + "." +
#               "And the cuisine type is " + self.type + ".")
#     def open(self):
#         print("the " + self.name + " is opening!")
#     def read_served(self):
#         print(str(self.number_served) + " people have already come here!")
#     def set_number_served(self,number):
#         self.number_served =  number
#     def increment_served(self, increase):
#         self.number_served += increase
#         print("we can only service " + str(increase) + " people in one day.")
# new_restaurant = Restaurant("take", "mexico")
# new_restaurant.set_number_served(20)
# new_restaurant.read_served()
# new_restaurant.increment_served(10)
# new_restaurant.read_served()
#9-5
class User():
    def __init__(self, first_name, last_name):
        self.first_name = first_name
        self.last_name = last_name
        self.login_attempts = 0
    def describe(self):
        print("the user's full name is " + self.first_name.title() + " " + self.last_name.title() + ".")
    def greet(self):
        print("hello! " + self.first_name.title() + " " + self.last_name.title())
    def increment_login(self):
        self.login_attempts += 1
        print("the number of the login is: " + str(self.login_attempts))
    def reset_login(self):
        self.login_attempts = 0
        print("the number of the login is: " + str(self.login_attempts))
user = User("albert", "einstein")
user.increment_login()
user.increment_login()
user.increment_login()
user.reset_login()

